using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: daiduong19051986@gmail.com 
	/// <summary>
	
    public class CategoryInfo
    {
		#region Local Variable
		public enum Field
		{
			DTB,
			Code,
			Lookup,
			Description,
			Header,
			Length,
			QdCode,
			NodeCode,
			NodeDesc,
			NodeLookup,
			NodeStatus
		}
		private String _DTB;
		private String _Code;
		private String _Lookup;
		private String _Description;
		private String _Header;
		private Int32 _Length;
		private String _QdCode;
		private String _NodeCode;
		private String _NodeDesc;
		private String _NodeLookup;
		private String _NodeStatus;
		
		public String DTB{	get{ return _DTB;} set{_DTB = value;} }
		public String Code{	get{ return _Code;} set{_Code = value;} }
		public String Lookup{	get{ return _Lookup;} set{_Lookup = value;} }
		public String Description{	get{ return _Description;} set{_Description = value;} }
		public String Header{	get{ return _Header;} set{_Header = value;} }
		public Int32 Length{	get{ return _Length;} set{_Length = value;} }
		public String QdCode{	get{ return _QdCode;} set{_QdCode = value;} }
		public String NodeCode{	get{ return _NodeCode;} set{_NodeCode = value;} }
		public String NodeDesc{	get{ return _NodeDesc;} set{_NodeDesc = value;} }
		public String NodeLookup{	get{ return _NodeLookup;} set{_NodeLookup = value;} }
		public String NodeStatus{	get{ return _NodeStatus;} set{_NodeStatus = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public CategoryInfo()
		{
			_DTB = "";
			_Code = "";
			_Lookup = "";
			_Description = "";
			_Header = "";
			_Length = 0;
			_QdCode = "";
			_NodeCode = "";
			_NodeDesc = "";
			_NodeLookup = "";
			_NodeStatus = "";
		}
		public CategoryInfo(
		String DTB,
		String Code,
		String Lookup,
		String Description,
		String Header,
		Int32 Length,
		String QdCode,
		String NodeCode,
		String NodeDesc,
		String NodeLookup,
		String NodeStatus
		)
		{
			_DTB = DTB;
			_Code = Code;
			_Lookup = Lookup;
			_Description = Description;
			_Header = Header;
			_Length = Length;
			_QdCode = QdCode;
			_NodeCode = NodeCode;
			_NodeDesc = NodeDesc;
			_NodeLookup = NodeLookup;
			_NodeStatus = NodeStatus;
		}
		public CategoryInfo(DataRow dr)
		{
			if (dr != null)
			{
				_DTB = dr[Field.DTB.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DTB.ToString()]);
				_Code = dr[Field.Code.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Code.ToString()]);
				_Lookup = dr[Field.Lookup.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Lookup.ToString()]);
				_Description = dr[Field.Description.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Description.ToString()]);
				_Header = dr[Field.Header.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Header.ToString()]);
				_Length = dr[Field.Length.ToString()] == DBNull.Value?0:Convert.ToInt32(dr[Field.Length.ToString()]);
				_QdCode = dr[Field.QdCode.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.QdCode.ToString()]);
				_NodeCode = dr[Field.NodeCode.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NodeCode.ToString()]);
				_NodeDesc = dr[Field.NodeDesc.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NodeDesc.ToString()]);
				_NodeLookup = dr[Field.NodeLookup.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NodeLookup.ToString()]);
				_NodeStatus = dr[Field.NodeStatus.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NodeStatus.ToString()]);
			}
		}
		public CategoryInfo(DataRowView dr)
		{
			if (dr != null)
			{
				_DTB = dr[Field.DTB.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DTB.ToString()]);
				_Code = dr[Field.Code.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Code.ToString()]);
				_Lookup = dr[Field.Lookup.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Lookup.ToString()]);
				_Description = dr[Field.Description.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Description.ToString()]);
				_Header = dr[Field.Header.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Header.ToString()]);
				_Length = dr[Field.Length.ToString()] == DBNull.Value?0:Convert.ToInt32(dr[Field.Length.ToString()]);
				_QdCode = dr[Field.QdCode.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.QdCode.ToString()]);
				_NodeCode = dr[Field.NodeCode.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NodeCode.ToString()]);
				_NodeDesc = dr[Field.NodeDesc.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NodeDesc.ToString()]);
				_NodeLookup = dr[Field.NodeLookup.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NodeLookup.ToString()]);
				_NodeStatus = dr[Field.NodeStatus.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NodeStatus.ToString()]);
			}
		}
		public CategoryInfo(CategoryInfo objEntr)
		{			
			_DTB = objEntr.DTB;			
			_Code = objEntr.Code;			
			_Lookup = objEntr.Lookup;			
			_Description = objEntr.Description;			
			_Header = objEntr.Header;			
			_Length = objEntr.Length;			
			_QdCode = objEntr.QdCode;			
			_NodeCode = objEntr.NodeCode;			
			_NodeDesc = objEntr.NodeDesc;			
			_NodeLookup = objEntr.NodeLookup;			
			_NodeStatus = objEntr.NodeStatus;			
		}
        #endregion Constructor
        #region InitTable
        public static DataTable ToDataTable()
        {
            DataTable dt = new DataTable("Category");
            dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.DTB.ToString(), typeof(String)),
				new DataColumn(Field.Code.ToString(), typeof(String)),
				new DataColumn(Field.Lookup.ToString(), typeof(String)),
				new DataColumn(Field.Description.ToString(), typeof(String)),
				new DataColumn(Field.Header.ToString(), typeof(String)),
				new DataColumn(Field.Length.ToString(), typeof(Int32)),
				new DataColumn(Field.QdCode.ToString(), typeof(String)),
				new DataColumn(Field.NodeCode.ToString(), typeof(String)),
				new DataColumn(Field.NodeDesc.ToString(), typeof(String)),
				new DataColumn(Field.NodeLookup.ToString(), typeof(String)),
				new DataColumn(Field.NodeStatus.ToString(), typeof(String))
			});
            return dt;
        }
        public DataRow ToDataRow(DataTable dt)
        {
            DataRow row = dt.NewRow();
            row[Field.DTB.ToString()] = _DTB;
            row[Field.Code.ToString()] = _Code;
            row[Field.Lookup.ToString()] = _Lookup;
            row[Field.Description.ToString()] = _Description;
            row[Field.Header.ToString()] = _Header;
            row[Field.Length.ToString()] = _Length;
            row[Field.QdCode.ToString()] = _QdCode;
            row[Field.NodeCode.ToString()] = _NodeCode;
            row[Field.NodeDesc.ToString()] = _NodeDesc;
            row[Field.NodeLookup.ToString()] = _NodeLookup;
            row[Field.NodeStatus.ToString()] = _NodeStatus;
            return row;
        }
        #endregion InitTable
    }
}
